#pragma once

#include "KeyInfo.h"
#include "PublicKey.h"
#include "SymmetricKey.h"

#include <vector>

namespace kryptos { namespace cryptography {


class KeyGenerator
{
public:

    static void init();

    static SymmetricKey* generateSessionKey(int size);

    static PrivateKey   generateKey        (const kryptos::entities::KeyInfo& info, kryptos::entities::KeyInfo::KeyType type);
    static PrivateKey   generateEncodedKey (const kryptos::entities::KeyInfo& info, kryptos::entities::KeyInfo::KeyType type);

    static PrivateKey   privateKeyFromBytes(const kryptos::entities::KeyInfo& info, const std::vector<char>& privatePart, const std::vector<char>& publicPart);
    static PublicKey    publicKeyFromBytes (const kryptos::entities::KeyInfo& info, const std::vector<char>& publicPart);

    static PrivateKey   encodeKey          (const PrivateKey& pk);
    static std::string  generateKeyId      (const PrivateKey& pk);

    static std::string  certificateFromKey      (const PrivateKey& pk);
    static PublicKey    publicKeyFromCertificate(const std::string& certificateFile);

private:
    KeyGenerator();
};

}}

